package com.zhuss.order.db.dao.ext;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.zhuss.bean.bo.order.order.SearchOrderBo;
import com.zhuss.bean.bo.order.order.SearchOrderItemBo;
import com.zhuss.bean.bo.order.order.app.ListTicketBo;
import com.zhuss.bean.unit.order.OrderItemBean;
import com.zhuss.bean.unit.order.TrainGroupBean;
import com.zhuss.bean.unit.product.TrainBean;
import com.zhuss.bean.vo.order.order.DetailOrderItemVo;
import com.zhuss.bean.vo.order.order.ListOrderItemVo;
import com.zhuss.bean.vo.order.order.app.DetailTicketVo;
import com.zhuss.bean.vo.order.order.app.ListTicketVo;
import com.zhuss.order.db.dao.gen.OrderItemMapper;
import com.zhuss.order.db.entity.OrderItem;

/**
 * @description: 订单明细数据库Dao
 * @author: zhushanshuo
 * @create: Tue Jan 12 13:51:36 CST 2021
 **/

@Mapper
public interface OrderItemDao extends OrderItemMapper {

	void create(OrderItem record);

	void delete(OrderItem record);

	void refreshStatus(@Param ("orderId") Long orderId, @Param ("status") Integer status, @Param("modifier") String modifier, @Param("modifierId") Long modifierId, @Param("modifyTime") Date modifyTime);
	
	void refreshItemStatus(@Param ("orderId") Long orderId, @Param ("trainId") Long trainId, @Param ("status") Integer status, @Param("modifier") String modifier, @Param("modifierId") Long modifierId, @Param("modifyTime") Date modifyTime);

	void refreshStatusByTrain(@Param ("orderId") Long orderId, @Param ("trainId") Long trainId, @Param ("status") Integer status, @Param("modifier") String modifier, @Param("modifierId") Long modifierId, @Param("modifyTime") Date modifyTime);
	
	void cancelBatch(@Param("orderIdList") List<Long> orderIdList, @Param("status") Integer status, @Param("modifier") String modifier, @Param("modifierId") Long modifierId, @Param("modifyTime") Date modifyTime);

	void cancel(@Param("orderId") Long orderId, @Param("status") Integer status, @Param("modifier") String modifier, @Param("modifierId") Long modifierId, @Param("modifyTime") Date modifyTime);

	List<TrainBean> listTrainHasBuy(@Param("trainIdList") List<Long> trainIdList, @Param("userId") Long userId);

	
	List<TrainGroupBean> listTrain(@Param("orderIdList") List<Long> orderIdList);
	
	DetailOrderItemVo getTrainByTake(@Param("orderId") Long orderId, @Param("trainId") Long trainId, @Param("status") Integer status);
	
	DetailTicketVo getTrain(@Param("orderId") Long orderId, @Param("trainId") Long trainId, @Param("statusList") List<Integer> statusList);

	List<OrderItemBean> listByOrder(@Param("orderId") Long orderId);

	OrderItemBean listByOrderAndTrain(@Param("orderId") Long orderId, @Param("trainId") Long trainId);

	List<OrderItem> listAll();

	List<OrderItem> listById(@Param("orderItemIdList") List<Long> orderItemIdList);

	List<OrderItem> listByName(@Param("name") String name);

	List<ListOrderItemVo> list(SearchOrderItemBo bo);

	Integer countList(SearchOrderItemBo bo);
	
	List<com.zhuss.bean.vo.order.order.app.ListTicketVo> listTicket(ListTicketBo bo);
	
	Integer countListTicket(ListTicketBo bo);

	ListTicketVo latestTicket(@Param("userId") Long userId, @Param("date") Date date, @Param("status") Integer status);

	DetailOrderItemVo detail(@Param("orderItemId") Long orderItemId);

	List<ListOrderItemVo> soldList(@Param("bo") SearchOrderItemBo bo, @Param("statusList") List<Integer> statusList);

	Integer countSoldList(@Param("bo") SearchOrderItemBo bo, @Param("statusList") List<Integer> statusList);
	
	List<ListOrderItemVo> ticketListPC(SearchOrderBo bo);
	
	Integer countTicketListPC(SearchOrderBo bo);

	List<Date> getDateByOrderId(@Param("orderId") Long orderId);



}
